import { CpcBase, ICpcBaseIos } from "../base/CpcBase";

const ios: ICpcBaseIos = {
    inputs: [
        {
            name: "输入的数据",
            type: 0,
        },
    ],
    outputs: [],
};

export class CpcConsole extends CpcBase {
    public title = "控制台打印";

    public desc = "控制台打印";

    public type = "CpcConsole";

    public properties = {
        type: "log",
    };

    constructor(title?: string) {
        super(ios, title);
        this.addWidget("combo", "打印级别", "log", () => {}, { values: ["log", "warn", "info", "error", "debug", "table"], property: "type" });
    }

    cpcRunCode(preDatas: any[], inputInfos: any[], outputInfos: any[]): any[] {
        // @ts-ignore
        console[this.properties.type](preDatas[0]);
        return preDatas;
    }
}
